<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>OS系统接口查询手册: D:/code/LiteOS/os/inc/objTask.h 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">OS系统接口查询手册
   &#160;<span id="projectnumber">v1.0</span>
   </div>
   <div id="projectbrief">Janisa</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="namespaces.html"><span>命名空间</span></a></li>
      <li><a href="annotated.html"><span>类</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_8b7cb6c889a10e2a101a7e90c854ca4d.html">os</a></li><li class="navelem"><a class="el" href="dir_74a0f00179eada1dfee08aecb51588ec.html">inc</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">objTask.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef __OBJTASK_H__</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#define __OBJTASK_H__</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &lt;map&gt;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &lt;mutex&gt;</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &lt;queue&gt;</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &lt;thread&gt;</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &lt;atomic&gt;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &lt;condition_variable&gt;</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;future&gt;</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;functional&gt;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;string.h&gt;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;objbase.h&gt;</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &quot;type.h&quot;</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div>
<div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="classobjPara.html">   17</a></span>&#160;<span class="keyword">class </span><a class="code" href="classobjPara.html">objPara</a></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;{</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="classobjPara.html#a451f9bea70defa08a713ce8017835881">   20</a></span>&#160;    <a class="code" href="classobjPara.html#a451f9bea70defa08a713ce8017835881">objPara</a>(<span class="keywordtype">void</span> *obj) { <a class="code" href="classobjPara.html#aaf14d34c457c4dfa04fcb0d17719e7b0">m_para</a> = obj; }</div>
<div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="classobjPara.html#ac0b01fd7d7baea2a4b4e7a4ea12ad044">   21</a></span>&#160;    <a class="code" href="classobjPara.html#ac0b01fd7d7baea2a4b4e7a4ea12ad044">~objPara</a>() {}</div>
<div class="line"><a name="l00022"></a><span class="lineno"><a class="line" href="classobjPara.html#aec175cc280f325d52fd5cc76d03f48e9">   22</a></span>&#160;    <span class="keywordtype">void</span> *<a class="code" href="classobjPara.html#aec175cc280f325d52fd5cc76d03f48e9">GetPara</a>() { <span class="keywordflow">return</span> <a class="code" href="classobjPara.html#aaf14d34c457c4dfa04fcb0d17719e7b0">m_para</a>; }</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="classobjPara.html#aaf14d34c457c4dfa04fcb0d17719e7b0">   25</a></span>&#160;    <span class="keywordtype">void</span> *<a class="code" href="classobjPara.html#aaf14d34c457c4dfa04fcb0d17719e7b0">m_para</a>;</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;};</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="keyword">typedef</span> <span class="keywordtype">void</span> *(*FunEntry)(<a class="code" href="classobjPara.html">objPara</a> *pobjPara);</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#define TASK_NAME_LEN 32</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="classobjTask.html">   29</a></span>&#160;<span class="keyword">class </span><a class="code" href="classobjTask.html">objTask</a></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;{</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    <a class="code" href="classobjTask.html#ad555de37ad24cc03aa83364e37f0792e">objTask</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *pzName, FunEntry func, <a class="code" href="classobjPara.html">objPara</a> *obj);</div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="classobjTask.html#a94909eba8ad8946db1905621f8078835">   34</a></span>&#160;    <span class="keyword">inline</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="classobjTask.html#a94909eba8ad8946db1905621f8078835">Name</a>() { <span class="keywordflow">return</span> <a class="code" href="classobjTask.html#a13657402f666f878c010a70a9c4cbc52">name</a>; }</div>
<div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="classobjTask.html#ae3eac17720cc52d73dd4dbdbc51750d6">   35</a></span>&#160;    <span class="keyword">inline</span> u64 <a class="code" href="classobjTask.html#ae3eac17720cc52d73dd4dbdbc51750d6">GetId</a>() { <span class="keywordflow">return</span> <a class="code" href="classobjTask.html#a15cf3265ab01a3cd4d512fc3af168f49">tId</a>; }</div>
<div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="classobjTask.html#a1c7b35b6f071bb8b4f83c179b3f8b009">   36</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classobjTask.html#a1c7b35b6f071bb8b4f83c179b3f8b009">SetId</a>(u64 <span class="keywordtype">id</span>) { <a class="code" href="classobjTask.html#a15cf3265ab01a3cd4d512fc3af168f49">tId</a> = id; }</div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="classobjTask.html#a402d3b9d61b5875f2f2f0478f92eec84">   37</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="classobjPara.html">objPara</a> *<a class="code" href="classobjTask.html#a402d3b9d61b5875f2f2f0478f92eec84">Para</a>() { <span class="keywordflow">return</span> <a class="code" href="classobjTask.html#ab40526572e560476a42d4ec33c3017f4">m_objPara</a>; }</div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="classobjTask.html#a4ae9d4839750069be0f9835d52cf2433">   38</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classobjTask.html#a4ae9d4839750069be0f9835d52cf2433">Run</a>() { <a class="code" href="classobjTask.html#a755f82dc6f0c81653c63780ff8528097">m_func</a>(<a class="code" href="classobjTask.html#ab40526572e560476a42d4ec33c3017f4">m_objPara</a>); }</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    <a class="code" href="classobjTask.html#a3f13e92a22c5871a0c5aa677732f59cf">~objTask</a>();</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <a class="code" href="classobjTask.html#ad555de37ad24cc03aa83364e37f0792e">objTask</a>() = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    <a class="code" href="classobjTask.html#ad555de37ad24cc03aa83364e37f0792e">objTask</a>(<a class="code" href="classobjTask.html">objTask</a> &amp;) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="classobjTask.html#a15cf3265ab01a3cd4d512fc3af168f49">   44</a></span>&#160;    u64 <a class="code" href="classobjTask.html#a15cf3265ab01a3cd4d512fc3af168f49">tId</a> = 0;</div>
<div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="classobjTask.html#a13657402f666f878c010a70a9c4cbc52">   45</a></span>&#160;    <span class="keywordtype">char</span> <a class="code" href="classobjTask.html#a13657402f666f878c010a70a9c4cbc52">name</a>[TASK_NAME_LEN] = {0};</div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="classobjTask.html#a755f82dc6f0c81653c63780ff8528097">   46</a></span>&#160;    FunEntry <a class="code" href="classobjTask.html#a755f82dc6f0c81653c63780ff8528097">m_func</a>;</div>
<div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="classobjTask.html#ab40526572e560476a42d4ec33c3017f4">   47</a></span>&#160;    <a class="code" href="classobjPara.html">objPara</a> *<a class="code" href="classobjTask.html#ab40526572e560476a42d4ec33c3017f4">m_objPara</a>;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;};</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;</div>
<div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="classobjTaskMgr.html">   50</a></span>&#160;<span class="keyword">class </span><a class="code" href="classobjTaskMgr.html">objTaskMgr</a> : <span class="keyword">public</span> <a class="code" href="classobjbase.html">objbase</a></div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;{</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;    <span class="keyword">static</span> <a class="code" href="classobjTaskMgr.html">objTaskMgr</a> *<a class="code" href="classobjTaskMgr.html#a7444ef8ba698509adb014cbb5c4cec4a">GetInstance</a>();</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classobjTaskMgr.html#a187477fa5f4263b920591b8633221673">addObj</a>(<a class="code" href="classobjTask.html">objTask</a> *obj);</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classobjTaskMgr.html#a04632cacbb3daf0b17975b2a118d474f">delObj</a>(u64 <span class="keywordtype">id</span>);</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <a class="code" href="classobjTaskMgr.html#a9313050f0a8156f6d37f7f576f8c6f1e">~objTaskMgr</a>();</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    <a class="code" href="classobjTaskMgr.html#ac6c94c695c2a8bc62269d07a3100e4ef">objTaskMgr</a>();</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classobjTaskMgr.html#a0b7d782dc98896f68d422cd5069ad6cb">dump</a>(<span class="keywordtype">int</span> fd = 0, Printfun callback = LVOS_Printf);</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <a class="code" href="classobjTaskMgr.html#ac6c94c695c2a8bc62269d07a3100e4ef">objTaskMgr</a>(<a class="code" href="classobjTaskMgr.html">objTaskMgr</a> &amp;) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    <span class="keyword">const</span> <a class="code" href="classobjTaskMgr.html">objTaskMgr</a> &amp;<a class="code" href="classobjTaskMgr.html#a561d636a14f80ab74d582768ba31b874">operator=</a>(<span class="keyword">const</span> <a class="code" href="classobjTaskMgr.html">objTaskMgr</a> &amp;) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="classobjTaskMgr.html#aa557a7a3f50622a727dd1b29f1c68b0c">   64</a></span>&#160;    std::map&lt;u64, objTask *&gt; <a class="code" href="classobjTaskMgr.html#aa557a7a3f50622a727dd1b29f1c68b0c">m_objlist</a>;</div>
<div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="classobjTaskMgr.html#aa25aca7b8538e2c7f658957176d6f576">   65</a></span>&#160;    std::mutex <a class="code" href="classobjTaskMgr.html#aa25aca7b8538e2c7f658957176d6f576">m_lock</a>;</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;};</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;<span class="preprocessor">#define CREATE_OBJTASK(objTaskName, func, pObjPara) \</span></div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="preprocessor">    objTaskEntry(objTaskName, func, pObjPara, __FILE__, __LINE__)</span></div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;<a class="code" href="classobjTask.html">objTask</a> *objTaskEntry(<span class="keyword">const</span> <span class="keywordtype">char</span> *objTaskName,</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;                      FunEntry func,</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;                      <a class="code" href="classobjPara.html">objPara</a> *pObjPara,</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;                      <span class="keyword">const</span> <span class="keywordtype">char</span> *file,</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;                      <span class="keywordtype">int</span> len);</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;</div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="classworkQ.html">   77</a></span>&#160;<span class="keyword">class </span><a class="code" href="classworkQ.html">workQ</a> : <span class="keyword">public</span> <a class="code" href="classobjbase.html">objbase</a></div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;{</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="classworkQ.html#a49d8b3d9d8d2b7acb96f17983d2081f5">   81</a></span>&#160;    <span class="keyword">using</span> <a class="code" href="classworkQ.html#a49d8b3d9d8d2b7acb96f17983d2081f5">Task</a> = std::function&lt;void()&gt;;</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;    <a class="code" href="classworkQ.html#adb1f68cf7fef4b0c9654e9d4e595f48c">workQ</a>(<a class="code" href="classworkQ.html">workQ</a> &amp;) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;    <span class="keyword">const</span> <a class="code" href="classworkQ.html">workQ</a> &amp;<a class="code" href="classworkQ.html#a0177290f8ec39e9c57440963806f3102">operator=</a>(<span class="keyword">const</span> <a class="code" href="classworkQ.html">workQ</a> &amp;) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    <span class="comment">// 任务队列</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"><a class="line" href="classworkQ.html#ae147b4e46c070c33d1b017ce8d00817e">   85</a></span>&#160;    std::queue&lt;Task&gt; <a class="code" href="classworkQ.html#ae147b4e46c070c33d1b017ce8d00817e">tasks</a>;</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    <span class="comment">// 同步</span></div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="classworkQ.html#aebfc46298ff902e9eea94b3a137c8571">   87</a></span>&#160;    std::mutex <a class="code" href="classworkQ.html#aebfc46298ff902e9eea94b3a137c8571">m_lock</a>;</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    <span class="comment">// 条件阻塞</span></div>
<div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="classworkQ.html#a1758d7c9b803763ef0c9336e5f1a4d05">   89</a></span>&#160;    std::condition_variable <a class="code" href="classworkQ.html#a1758d7c9b803763ef0c9336e5f1a4d05">cv_task</a>;</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;    <span class="comment">// 是否关闭提交</span></div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="line" href="classworkQ.html#af2ba8bdd5c53b87fd93ddb5d0b9cb548">   91</a></span>&#160;    std::atomic&lt;bool&gt; <a class="code" href="classworkQ.html#af2ba8bdd5c53b87fd93ddb5d0b9cb548">stoped</a>;</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classworkQ.html#aad884e9aec439406004b0ec6d8a38fb1">sysShutdown</a>(<a class="code" href="classCAgrcList.html">CAgrcList</a> *message, <a class="code" href="struct__RspMsg.html">RspMsg</a> *outmessage,</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;                    <span class="keywordtype">int</span> iModule, <span class="keywordtype">int</span> iCmd);</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;    <a class="code" href="classworkQ.html#adb1f68cf7fef4b0c9654e9d4e595f48c">workQ</a>();</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    <a class="code" href="classworkQ.html#a737a01b2d619c8b89435c1ce805c1e3e">~workQ</a>();</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classworkQ.html#ab3cfd151776b9839c50412b7c90c77db">dump</a>(<span class="keywordtype">int</span> fd = 0, Printfun callback = LVOS_Printf);</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classworkQ.html#a5072453f4689415892a2e71ca30ab4db">Init</a>();</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classworkQ.html#a5b9ab181d5da33d70b49aab2a6ca69f4">Proc</a>();</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classworkQ.html#af0d973ab87b2421685cd072e86dd0be8">Process</a>(<a class="code" href="classCAgrcList.html">CAgrcList</a> *message, <a class="code" href="struct__RspMsg.html">RspMsg</a> *outmessage, <span class="keywordtype">int</span> iModule, <span class="keywordtype">int</span> iCmd);</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">class </span>F, <span class="keyword">class</span>... Args&gt;</div>
<div class="line"><a name="l00103"></a><span class="lineno"><a class="line" href="classworkQ.html#a35c9fbc22bdb51271d09c47664f4e3bc">  103</a></span>&#160;    STATUS <a class="code" href="classworkQ.html#a35c9fbc22bdb51271d09c47664f4e3bc">commit</a>(F &amp;&amp;f, Args &amp;&amp;... args)</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    {</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;        <span class="keywordflow">if</span> (stoped.load())</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;            <span class="keywordflow">return</span> ERROR;</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;        <span class="keyword">using</span> RetType = decltype(f(args...));</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;        <span class="keyword">auto</span> task = std::make_shared&lt;std::packaged_task&lt;RetType()&gt;&gt;(</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;            std::bind(std::forward&lt;F&gt;(f), std::forward&lt;Args&gt;(args)...));</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;        std::lock_guard&lt;std::mutex&gt; lock{m_lock};</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;        tasks.emplace(</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;            [task]() {</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;                (*task)();</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;            });</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;        cv_task.notify_one();</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;        <span class="keywordflow">return</span> SUCCESS;</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    }</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;};</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="ttc" id="classworkQ_html_a0177290f8ec39e9c57440963806f3102"><div class="ttname"><a href="classworkQ.html#a0177290f8ec39e9c57440963806f3102">workQ::operator=</a></div><div class="ttdeci">const workQ &amp; operator=(const workQ &amp;)=delete</div></div>
<div class="ttc" id="classobjTask_html_ad555de37ad24cc03aa83364e37f0792e"><div class="ttname"><a href="classobjTask.html#ad555de37ad24cc03aa83364e37f0792e">objTask::objTask</a></div><div class="ttdeci">objTask()=delete</div></div>
<div class="ttc" id="classCAgrcList_html"><div class="ttname"><a href="classCAgrcList.html">CAgrcList</a></div><div class="ttdef"><b>Definition:</b> cargclist.h:8</div></div>
<div class="ttc" id="classobjTask_html_a755f82dc6f0c81653c63780ff8528097"><div class="ttname"><a href="classobjTask.html#a755f82dc6f0c81653c63780ff8528097">objTask::m_func</a></div><div class="ttdeci">FunEntry m_func</div><div class="ttdef"><b>Definition:</b> objTask.h:46</div></div>
<div class="ttc" id="classworkQ_html_adb1f68cf7fef4b0c9654e9d4e595f48c"><div class="ttname"><a href="classworkQ.html#adb1f68cf7fef4b0c9654e9d4e595f48c">workQ::workQ</a></div><div class="ttdeci">workQ()</div><div class="ttdef"><b>Definition:</b> objTask.cpp:172</div></div>
<div class="ttc" id="struct__RspMsg_html"><div class="ttname"><a href="struct__RspMsg.html">_RspMsg</a></div><div class="ttdef"><b>Definition:</b> cargclist.h:69</div></div>
<div class="ttc" id="classobjTask_html_a13657402f666f878c010a70a9c4cbc52"><div class="ttname"><a href="classobjTask.html#a13657402f666f878c010a70a9c4cbc52">objTask::name</a></div><div class="ttdeci">char name[TASK_NAME_LEN]</div><div class="ttdef"><b>Definition:</b> objTask.h:45</div></div>
<div class="ttc" id="classobjTaskMgr_html_a561d636a14f80ab74d582768ba31b874"><div class="ttname"><a href="classobjTaskMgr.html#a561d636a14f80ab74d582768ba31b874">objTaskMgr::operator=</a></div><div class="ttdeci">const objTaskMgr &amp; operator=(const objTaskMgr &amp;)=delete</div></div>
<div class="ttc" id="classobjTask_html_a402d3b9d61b5875f2f2f0478f92eec84"><div class="ttname"><a href="classobjTask.html#a402d3b9d61b5875f2f2f0478f92eec84">objTask::Para</a></div><div class="ttdeci">objPara * Para()</div><div class="ttdef"><b>Definition:</b> objTask.h:37</div></div>
<div class="ttc" id="classobjPara_html_a451f9bea70defa08a713ce8017835881"><div class="ttname"><a href="classobjPara.html#a451f9bea70defa08a713ce8017835881">objPara::objPara</a></div><div class="ttdeci">objPara(void *obj)</div><div class="ttdef"><b>Definition:</b> objTask.h:20</div></div>
<div class="ttc" id="classobjTask_html_a15cf3265ab01a3cd4d512fc3af168f49"><div class="ttname"><a href="classobjTask.html#a15cf3265ab01a3cd4d512fc3af168f49">objTask::tId</a></div><div class="ttdeci">u64 tId</div><div class="ttdef"><b>Definition:</b> objTask.h:44</div></div>
<div class="ttc" id="classworkQ_html_af0d973ab87b2421685cd072e86dd0be8"><div class="ttname"><a href="classworkQ.html#af0d973ab87b2421685cd072e86dd0be8">workQ::Process</a></div><div class="ttdeci">int Process(CAgrcList *message, RspMsg *outmessage, int iModule, int iCmd)</div><div class="ttdef"><b>Definition:</b> objTask.cpp:187</div></div>
<div class="ttc" id="classobjTask_html"><div class="ttname"><a href="classobjTask.html">objTask</a></div><div class="ttdef"><b>Definition:</b> objTask.h:29</div></div>
<div class="ttc" id="classobjTaskMgr_html_aa557a7a3f50622a727dd1b29f1c68b0c"><div class="ttname"><a href="classobjTaskMgr.html#aa557a7a3f50622a727dd1b29f1c68b0c">objTaskMgr::m_objlist</a></div><div class="ttdeci">std::map&lt; u64, objTask * &gt; m_objlist</div><div class="ttdef"><b>Definition:</b> objTask.h:64</div></div>
<div class="ttc" id="classobjPara_html_aaf14d34c457c4dfa04fcb0d17719e7b0"><div class="ttname"><a href="classobjPara.html#aaf14d34c457c4dfa04fcb0d17719e7b0">objPara::m_para</a></div><div class="ttdeci">void * m_para</div><div class="ttdef"><b>Definition:</b> objTask.h:25</div></div>
<div class="ttc" id="classworkQ_html"><div class="ttname"><a href="classworkQ.html">workQ</a></div><div class="ttdef"><b>Definition:</b> objTask.h:77</div></div>
<div class="ttc" id="classobjPara_html_ac0b01fd7d7baea2a4b4e7a4ea12ad044"><div class="ttname"><a href="classobjPara.html#ac0b01fd7d7baea2a4b4e7a4ea12ad044">objPara::~objPara</a></div><div class="ttdeci">~objPara()</div><div class="ttdef"><b>Definition:</b> objTask.h:21</div></div>
<div class="ttc" id="classobjTaskMgr_html_a9313050f0a8156f6d37f7f576f8c6f1e"><div class="ttname"><a href="classobjTaskMgr.html#a9313050f0a8156f6d37f7f576f8c6f1e">objTaskMgr::~objTaskMgr</a></div><div class="ttdeci">~objTaskMgr()</div><div class="ttdef"><b>Definition:</b> objTask.cpp:21</div></div>
<div class="ttc" id="classworkQ_html_a5b9ab181d5da33d70b49aab2a6ca69f4"><div class="ttname"><a href="classworkQ.html#a5b9ab181d5da33d70b49aab2a6ca69f4">workQ::Proc</a></div><div class="ttdeci">void Proc()</div><div class="ttdef"><b>Definition:</b> objTask.cpp:149</div></div>
<div class="ttc" id="classobjTaskMgr_html"><div class="ttname"><a href="classobjTaskMgr.html">objTaskMgr</a></div><div class="ttdef"><b>Definition:</b> objTask.h:50</div></div>
<div class="ttc" id="classobjTask_html_ab40526572e560476a42d4ec33c3017f4"><div class="ttname"><a href="classobjTask.html#ab40526572e560476a42d4ec33c3017f4">objTask::m_objPara</a></div><div class="ttdeci">objPara * m_objPara</div><div class="ttdef"><b>Definition:</b> objTask.h:47</div></div>
<div class="ttc" id="classobjTask_html_ae3eac17720cc52d73dd4dbdbc51750d6"><div class="ttname"><a href="classobjTask.html#ae3eac17720cc52d73dd4dbdbc51750d6">objTask::GetId</a></div><div class="ttdeci">u64 GetId()</div><div class="ttdef"><b>Definition:</b> objTask.h:35</div></div>
<div class="ttc" id="classobjTask_html_a94909eba8ad8946db1905621f8078835"><div class="ttname"><a href="classobjTask.html#a94909eba8ad8946db1905621f8078835">objTask::Name</a></div><div class="ttdeci">const char * Name()</div><div class="ttdef"><b>Definition:</b> objTask.h:34</div></div>
<div class="ttc" id="classobjbase_html"><div class="ttname"><a href="classobjbase.html">objbase</a></div><div class="ttdef"><b>Definition:</b> objbase.h:11</div></div>
<div class="ttc" id="classobjTaskMgr_html_a7444ef8ba698509adb014cbb5c4cec4a"><div class="ttname"><a href="classobjTaskMgr.html#a7444ef8ba698509adb014cbb5c4cec4a">objTaskMgr::GetInstance</a></div><div class="ttdeci">static objTaskMgr * GetInstance()</div><div class="ttdef"><b>Definition:</b> objTask.cpp:25</div></div>
<div class="ttc" id="classobjTaskMgr_html_aa25aca7b8538e2c7f658957176d6f576"><div class="ttname"><a href="classobjTaskMgr.html#aa25aca7b8538e2c7f658957176d6f576">objTaskMgr::m_lock</a></div><div class="ttdeci">std::mutex m_lock</div><div class="ttdef"><b>Definition:</b> objTask.h:65</div></div>
<div class="ttc" id="classworkQ_html_a737a01b2d619c8b89435c1ce805c1e3e"><div class="ttname"><a href="classworkQ.html#a737a01b2d619c8b89435c1ce805c1e3e">workQ::~workQ</a></div><div class="ttdeci">~workQ()</div><div class="ttdef"><b>Definition:</b> objTask.cpp:175</div></div>
<div class="ttc" id="classobjPara_html_aec175cc280f325d52fd5cc76d03f48e9"><div class="ttname"><a href="classobjPara.html#aec175cc280f325d52fd5cc76d03f48e9">objPara::GetPara</a></div><div class="ttdeci">void * GetPara()</div><div class="ttdef"><b>Definition:</b> objTask.h:22</div></div>
<div class="ttc" id="classobjTaskMgr_html_a187477fa5f4263b920591b8633221673"><div class="ttname"><a href="classobjTaskMgr.html#a187477fa5f4263b920591b8633221673">objTaskMgr::addObj</a></div><div class="ttdeci">int addObj(objTask *obj)</div><div class="ttdef"><b>Definition:</b> objTask.cpp:46</div></div>
<div class="ttc" id="classworkQ_html_ae147b4e46c070c33d1b017ce8d00817e"><div class="ttname"><a href="classworkQ.html#ae147b4e46c070c33d1b017ce8d00817e">workQ::tasks</a></div><div class="ttdeci">std::queue&lt; Task &gt; tasks</div><div class="ttdef"><b>Definition:</b> objTask.h:85</div></div>
<div class="ttc" id="classobjTask_html_a1c7b35b6f071bb8b4f83c179b3f8b009"><div class="ttname"><a href="classobjTask.html#a1c7b35b6f071bb8b4f83c179b3f8b009">objTask::SetId</a></div><div class="ttdeci">void SetId(u64 id)</div><div class="ttdef"><b>Definition:</b> objTask.h:36</div></div>
<div class="ttc" id="classobjPara_html"><div class="ttname"><a href="classobjPara.html">objPara</a></div><div class="ttdef"><b>Definition:</b> objTask.h:17</div></div>
<div class="ttc" id="classworkQ_html_a35c9fbc22bdb51271d09c47664f4e3bc"><div class="ttname"><a href="classworkQ.html#a35c9fbc22bdb51271d09c47664f4e3bc">workQ::commit</a></div><div class="ttdeci">STATUS commit(F &amp;&amp;f, Args &amp;&amp;...args)</div><div class="ttdef"><b>Definition:</b> objTask.h:103</div></div>
<div class="ttc" id="classworkQ_html_a5072453f4689415892a2e71ca30ab4db"><div class="ttname"><a href="classworkQ.html#a5072453f4689415892a2e71ca30ab4db">workQ::Init</a></div><div class="ttdeci">int Init()</div><div class="ttdef"><b>Definition:</b> objTask.cpp:132</div></div>
<div class="ttc" id="classworkQ_html_aebfc46298ff902e9eea94b3a137c8571"><div class="ttname"><a href="classworkQ.html#aebfc46298ff902e9eea94b3a137c8571">workQ::m_lock</a></div><div class="ttdeci">std::mutex m_lock</div><div class="ttdef"><b>Definition:</b> objTask.h:87</div></div>
<div class="ttc" id="classworkQ_html_af2ba8bdd5c53b87fd93ddb5d0b9cb548"><div class="ttname"><a href="classworkQ.html#af2ba8bdd5c53b87fd93ddb5d0b9cb548">workQ::stoped</a></div><div class="ttdeci">std::atomic&lt; bool &gt; stoped</div><div class="ttdef"><b>Definition:</b> objTask.h:91</div></div>
<div class="ttc" id="classobjTaskMgr_html_a0b7d782dc98896f68d422cd5069ad6cb"><div class="ttname"><a href="classobjTaskMgr.html#a0b7d782dc98896f68d422cd5069ad6cb">objTaskMgr::dump</a></div><div class="ttdeci">void dump(int fd=0, Printfun callback=LVOS_Printf)</div><div class="ttdef"><b>Definition:</b> objTask.cpp:29</div></div>
<div class="ttc" id="classworkQ_html_ab3cfd151776b9839c50412b7c90c77db"><div class="ttname"><a href="classworkQ.html#ab3cfd151776b9839c50412b7c90c77db">workQ::dump</a></div><div class="ttdeci">void dump(int fd=0, Printfun callback=LVOS_Printf)</div><div class="ttdef"><b>Definition:</b> objTask.cpp:180</div></div>
<div class="ttc" id="classobjTask_html_a3f13e92a22c5871a0c5aa677732f59cf"><div class="ttname"><a href="classobjTask.html#a3f13e92a22c5871a0c5aa677732f59cf">objTask::~objTask</a></div><div class="ttdeci">~objTask()</div><div class="ttdef"><b>Definition:</b> objTask.cpp:123</div></div>
<div class="ttc" id="classworkQ_html_aad884e9aec439406004b0ec6d8a38fb1"><div class="ttname"><a href="classworkQ.html#aad884e9aec439406004b0ec6d8a38fb1">workQ::sysShutdown</a></div><div class="ttdeci">int sysShutdown(CAgrcList *message, RspMsg *outmessage, int iModule, int iCmd)</div><div class="ttdef"><b>Definition:</b> objTask.cpp:193</div></div>
<div class="ttc" id="classobjTaskMgr_html_ac6c94c695c2a8bc62269d07a3100e4ef"><div class="ttname"><a href="classobjTaskMgr.html#ac6c94c695c2a8bc62269d07a3100e4ef">objTaskMgr::objTaskMgr</a></div><div class="ttdeci">objTaskMgr()</div><div class="ttdef"><b>Definition:</b> objTask.cpp:17</div></div>
<div class="ttc" id="classworkQ_html_a1758d7c9b803763ef0c9336e5f1a4d05"><div class="ttname"><a href="classworkQ.html#a1758d7c9b803763ef0c9336e5f1a4d05">workQ::cv_task</a></div><div class="ttdeci">std::condition_variable cv_task</div><div class="ttdef"><b>Definition:</b> objTask.h:89</div></div>
<div class="ttc" id="classobjTask_html_a4ae9d4839750069be0f9835d52cf2433"><div class="ttname"><a href="classobjTask.html#a4ae9d4839750069be0f9835d52cf2433">objTask::Run</a></div><div class="ttdeci">void Run()</div><div class="ttdef"><b>Definition:</b> objTask.h:38</div></div>
<div class="ttc" id="classobjTaskMgr_html_a04632cacbb3daf0b17975b2a118d474f"><div class="ttname"><a href="classobjTaskMgr.html#a04632cacbb3daf0b17975b2a118d474f">objTaskMgr::delObj</a></div><div class="ttdeci">void delObj(u64 id)</div><div class="ttdef"><b>Definition:</b> objTask.cpp:57</div></div>
<div class="ttc" id="classworkQ_html_a49d8b3d9d8d2b7acb96f17983d2081f5"><div class="ttname"><a href="classworkQ.html#a49d8b3d9d8d2b7acb96f17983d2081f5">workQ::Task</a></div><div class="ttdeci">std::function&lt; void()&gt; Task</div><div class="ttdef"><b>Definition:</b> objTask.h:81</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.10
</small></address>
</body>
</html>
